﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ActorInput : MonoBehaviour {
    public Actor actor;
	// Use this for initialization
	void Start ()
    {
		
	}
	
	// Update is called once per frame
	void Update ()
    {
        if (KeyDown(KeyCode.D))	
        {
            actor.Movedirection(1.0f);
        }
        else if(KeyDown(KeyCode.A))
        {
            actor.Movedirection(-1.0f);
        }
        else
        {
            actor.Movedirection(0.0f);
        }

        if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.Space))
        {
            actor.Jump();
        }
        if (Input.GetKeyDown(KeyCode.Z))
        {
            actor.Action();
        }
    }


    bool KeyDown(KeyCode kc)
    {
        return Input.GetKey(kc);
    }
}
